<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// 此函数称为工厂。能创建多个类似对象
			// 没有解决对象识别的问题。
			function createPerson(name,age){
				var obj = new Object;
				obj.name = name;
				obj.age = age;
				obj.sayName = function(){
					console.log('hello',name,age);
				}
				return obj;
			}
			var p1 = createPerson('fyr',10)
			var p2 = createPerson('zmm',12)
			p1.sayName()
		</script>
	</body>
</html>
